Fix potential bug when no keys exist
authorjustbur <justin@burkett.cc>
Fri, 17 Jul 2015 14:59:13 +0000 (10:59 -0400)
committerjustbur <justin@burkett.cc>
Fri, 17 Jul 2015 15:01:54 +0000 (11:01 -0400)
Need to check for no keys before checking the number of keys on the
first page in case the latter is nil

which-key.el

index ac57514d49115c5d9748f1c6168e1a311a42c5e6..b54aedb883ff55e2ece2ef69479e66ef3899cdb2 100644 (file)
@@ -894,15 +894,15 @@ value of `which-key-show-prefix'.  SEL-WIN-WIDTH is passed to
           pages (reverse pages)
           first-page (car pages)
           first-page-str (concat prefix-string (car first-page)))
-    (cond ((<= (car keys-per-page) 0) ; check first page
-           (message "%s-  which-key can't show keys: Settings and/or frame size are too restrictive." prefix-keys)
-           (cons 0 0))
-          (max-pages-reached
+    (cond (max-pages-reached
            (error "Which-key reached the maximum number of pages")
            (cons 0 0))
           ((<= (length formatted-keys) 0)
            (message "%s-  which-key: no keys to display" prefix-keys)
            (cons 0 0))
+          ((<= (car keys-per-page) 0) ; check first page
+           (message "%s-  which-key can't show keys: Settings and/or frame size are too restrictive." prefix-keys)
+           (cons 0 0))
           (t
            (if (eq which-key-popup-type 'minibuffer)
                (let (message-log-max) (message "%s" first-page-str))